#define _CRT_SECURE_NO_WARNINGS 1
class Solution {
public:
    int countStudents(vector<int>& students, vector<int>& sandwiches)
    {
        int arr[2] = { 0 };
        for (auto& a : students)
        {
            ++arr[a];
        }
        for (auto a : sandwiches)
        {
            //cout<<"arr[0]="<<arr[0]<<",arr[1]="<<arr[1]<<endl;
            if (arr[a] == 0)
            {
                return arr[0] + arr[1];
            }
            --arr[a];
        }
        return arr[0] + arr[1];
    }
};